﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using IService.Model;
using IService.Data;
using IService.DataDLL;

namespace IService.Business.Manager
{
	public class TypeManager
	{
		public DTVType GetTypeById(int Id)
		{
			DTVType type = new DTVType();
			type.ID = Id;
			return DTVData.TypeManager.GetTypeById(type);
		}

		public DataTable GetSubTypeListByPid(int parentId, int bigTypeId)
		{
			return DTVData.TypeManager.GetSubTypeListByPid(typeof(DTVType), parentId, bigTypeId);
		}

		//public DataTable GetParentTypeBySystem(string RegisterSystem)
		//{
		//    string Order = "[TypeName]";
		//    return DTVData.TypeManager.GetParentTypeBySystem(typeof(DTVType), RegisterSystem, Order);
		//}

		//public DataTable GetTypesBySystem(string RegisterSystem)
		//{
		//    string Order = "[TypeName]";
		//    return DTVData.TypeManager.GetTypesBySystem(typeof(DTVType), RegisterSystem, Order);
		//}

		public DataTable GetTypeListByYear(int year)
		{
			return DTVData.TypeManager.GetTypeListByYear(typeof(DTVType), year);
		}

		public DataTable GetTypeListAll()
		{
			return DTVData.TypeManager.GetTypeListAll(typeof(DTVType));
		}

		public DataTable GetTypeListPagin(PagingEntity pe)
		{
			return DTVData.TypeManager.GetTypeListPagin(typeof(DTVType), pe);
		}

		public int CountSubType(int parentId)
		{
			string WhereClause = "[ParentId]=" + parentId;
			return DTVData.TypeManager.CountSubType(typeof(DTVType), WhereClause);
		}

		public int CountSubType(string Ids)
		{
			string WhereClause = "[Id] in(" + Ids + ")";
			return DTVData.TypeManager.CountSubType(typeof(DTVType), WhereClause);
		}

		/// <summary>
		/// 更新
		/// </summary>
		/// <param name="news"></param>
		/// <returns></returns>
		public bool InsertType(DTVType type)
		{
			return DTVData.TypeManager.InsertType(type);
		}

		public bool UpdateType(DTVType type)
		{
			return DTVData.TypeManager.UpdateType(type);
		}

		public bool DeleteType(int Id)
		{
			DTVType type = new DTVType();
			type.ID = Id;
			return DTVData.TypeManager.DeleteType(type);
		}

		public bool DeleteTypeByIds(string Ids)
		{
			string WhereClause = "[Id] in(" + Ids + ")";
			return DTVData.TypeManager.DeleteTypeByIds(typeof(DTVType), WhereClause);
		}
	}
}
